package com.observable.test;

import java.util.Observable;
import java.util.Observer;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @date 2020-09-03 下午3:30
 */
public class Teacher implements Observer {
    private final String name;

    public Teacher(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        GPer gPer = (GPer) o;
        Question question = (Question) arg;
        System.out.println("===========================");
        System.out.println(name + "老师,你好!\n" + "您收到一个来自[" + gPer.getName() + "]的提问,希望您解答；问题的内容如下：\n"
                + question.getContent() + "\n" + "提问者:" + question.getUserName());
    }
}
